summaryrefslogtreecommitdiffstats
path: root/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt
new file mode 100644
index 000000000..3dfd66779
--- /dev/null
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt
@@ -0,0 +1,38 @@
+// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+package org.yuzu.yuzu_emu.features.settings.model
+
+enum class BooleanSetting(
+ override val key: String,
+ override val section: String,
+ override val defaultValue: Boolean
+) : AbstractBooleanSetting {
+ USE_CUSTOM_RTC("custom_rtc_enabled", Settings.SECTION_SYSTEM, false);
+
+ override var boolean: Boolean = defaultValue
+
+ override val valueAsString: String
+ get() = boolean.toString()
+
+ override val isRuntimeEditable: Boolean
+ get() {
+ for (setting in NOT_RUNTIME_EDITABLE) {
+ if (setting == this) {
+ return false
+ }
+ }
+ return true
+ }
+
+ companion object {
+ private val NOT_RUNTIME_EDITABLE = listOf(
+ USE_CUSTOM_RTC
+ )
+
+ fun from(key: String): BooleanSetting? =
+ BooleanSetting.values().firstOrNull { it.key == key }
+
+ fun clear() = BooleanSetting.values().forEach { it.boolean = it.defaultValue }
+ }
+}